home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Pascal / Games / Stella Obscura 1.1 / source / Parts ƒ / mainWndo.p < prev    next >
Encoding:
Text File  |  1990-05-12  |  2.2 KB  |  84 lines  |  [TEXT/PJMM]

  1. unit mainWndo;
  2.  
  3. interface
  4.     uses
  5.         Sound, SomeGlobals, Utilities;
  6.  
  7.     procedure Init_mainWndo;
  8.     procedure Close_mainWndo (whichWindow: WindowPtr; var theInput: TEHandle);
  9.     procedure Update_mainWndo (whichWindow: WindowPtr);
  10.     procedure BringUpStartUp;
  11.  
  12. implementation
  13.  
  14.     var
  15.         tempRect: Rect;                      {Temporary rectangle}
  16.         Index: Integer;                      {For looping}
  17.         CtrlHandle: controlhandle;           {Control handle}
  18.         sTemp: Str255;                       {Get text entered, temp holding}
  19.  
  20. {=================================}
  21.  
  22.     procedure Init_mainWndo;
  23.     begin
  24.         mainWndo := nil;
  25.     end;
  26.  
  27. {=================================}
  28.  
  29.     procedure Close_mainWndo;
  30.     begin
  31.         if (mainWndo <> nil) and (mainWndo = whichWindow) then
  32.             begin
  33.                 DisposeWindow(mainWndo);
  34.                 mainWndo := nil;
  35.             end;
  36.     end;
  37.  
  38. {=================================}
  39.  
  40.     procedure UpDate_mainWndo;
  41.     begin
  42.         SetPort(mainWndo);
  43.         FillRect(mainWndo^.portRect, black);
  44.         CopyBits(offLeftVirginMap, offLeftMap, offLeftVirginMap.bounds, offLeftVirginMap.bounds, srcCopy, nil);
  45.         CopyBits(offRightVirginMap, offRightMap, offRightVirginMap.bounds, offRightVirginMap.bounds, srcCopy, nil);
  46.         CopyBits(offLeftMap, mainWndo^.portBits, offLeftMap.bounds, leftBckgrndDst, srcCopy, nil);
  47.         CopyBits(offRightMap, mainWndo^.portBits, offRightMap.bounds, rightBckgrndDst, srcCopy, nil);
  48.     end;
  49.  
  50. {=================================}
  51.  
  52.     procedure BringUpStartUp;
  53.         var
  54.             tempRect: Rect;
  55.             Pic_Handle: PicHandle;
  56.     begin
  57.         mainWndo := GetNewWindow(1, nil, Pointer(-1));
  58.         SelectWindow(mainWndo);
  59.         SetPort(mainWndo);
  60.         Pic_Handle := GetPicture(2002);
  61.         SetRect(tempRect, 0, 0, 512, 322);
  62.         if (Pic_Handle <> nil) then
  63.             begin
  64.                 ClipRect(tempRect);
  65.                 HLock(Handle(Pic_Handle));
  66.                 tempRect.Right := tempRect.Left + (Pic_Handle^^.picFrame.Right - Pic_Handle^^.picFrame.Left);
  67.                 tempRect.Bottom := tempRect.Top + (Pic_Handle^^.picFrame.Bottom - Pic_Handle^^.picFrame.Top);
  68.                 HUnLock(Handle(Pic_Handle));
  69.             end;
  70.         if (Pic_Handle <> nil) then
  71.             DrawPicture(Pic_Handle, tempRect);
  72.         ReleaseResource(Handle(Pic_Handle));
  73.         SetRect(tempRect, 0, 0, 1023, 1023);
  74.         ClipRect(tempRect);
  75.  
  76.         repeat
  77.         until (not button);
  78.         repeat
  79.         until (button);
  80.     end;
  81.  
  82. {=================================}
  83.  
  84. end.                                    {End of unit}